package com.bdsy.business.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.business.dao.ShopSellInfoMapper;
import com.bdsy.business.model.ShopSellInfo;
import com.bdsy.business.service.ShopSellInfoService;
import com.bdsy.common.utils.DateUtil;

@Service("shopSellInfoService")
public class ShopSellInfoServiceImpl implements ShopSellInfoService{

	@Autowired
	ShopSellInfoMapper shopSellInfoMapper;
	
	@Override
	public List<Map> selectShopSellInfo() {
		List<Map> shopSellInfoList = shopSellInfoMapper.selectShopSellInfo();
		return shopSellInfoList;
	}

	@Override
	public boolean add(ShopSellInfo shopSellInfo) {
		// 商品状态 0 1   待售  已售
		shopSellInfo.setShopStatus(0);
		// 商品状态 0 1   出售 租赁
//		shopSellInfo.setsStatus(0);
		shopSellInfo.setsIuse(0);
		//默认下架
		shopSellInfo.setStandDown(1);
		shopSellInfo.setAddTime(DateUtil.getCurrentDate());
		int result  = shopSellInfoMapper.insert(shopSellInfo);
		return result>0?true:false;
	}

	@Override
	public List<Map> selectShopSellInfoById(String userId) {
		List<Map> shopList = shopSellInfoMapper.selectShopSellInfoById(userId);
		return shopList;
	}

	@Override
	public List<Map> selectShopSellInfoByShopId(Integer shopId) {
		List<Map> shopList = shopSellInfoMapper.selectShopSellInfoByShopId(shopId);
		return shopList;
	}

	@Override
	public List<ShopSellInfo> selectShopInfo() {
		List<ShopSellInfo> shopSellList = shopSellInfoMapper.selectShopInfo();
		return shopSellList;
	}

	@Override
	public List<Map> shopSellInfoListByTypeId(Integer shopTypeId) {
		List<Map> shopSellInfoList = shopSellInfoMapper.shopSellInfoListByTypeId(shopTypeId);
		return shopSellInfoList;
	}

	@Override
	public int count(Integer shopTypeId) {
		int count = shopSellInfoMapper.count(shopTypeId);
		return count;
	}

	@Override
	public List<Map> selectzlShopSellInfo() {
		List<Map> zlshopSellInfoList = shopSellInfoMapper.selectzlShopSellInfo();
		return zlshopSellInfoList;
	}

	@Override
	public List<Map> shopzlSellInfoListByTypeId(Integer shopTypeId) {
		List<Map> shopzlSellInfoList = shopSellInfoMapper.shopzlSellInfoListByTypeId(shopTypeId);
		return shopzlSellInfoList;
	}

	@Override
	public int zcount(Integer shopTypeId) {
		int count = shopSellInfoMapper.zcount(shopTypeId);
		return count;
	}

	@Override
	public List<Map> selectzlShopSellInfoById(String userId) {
		List<Map> zlshopList = shopSellInfoMapper.selectzlShopSellInfoById(userId);
		return zlshopList;
	}

	@Override
	public List<Map> selectShopSellInfoByIcdn(String icdn) {
		List<Map> shopList = shopSellInfoMapper.selectShopSellInfoByIcdn(icdn);
		return shopList;
	}

	@Override
	public int sellCount(String userId) {
		int count = shopSellInfoMapper.sellCount(userId);
		return count;
	}

	@Override
	public int zlCount(String userId) {
		int zlCount = shopSellInfoMapper.zlCount(userId);
		return zlCount;
	}

	@Override
	public boolean delete(List<String> pIds) {
		int result = shopSellInfoMapper.delete(pIds);
		return result>0?true:false;
	}

	@Override
	public List<Map> selectShopSellInfoByIdStatus(String userId, int status,int standDown) {
		 List<Map> shopSellInfoList = shopSellInfoMapper.selectShopSellInfoByIdStatus(userId, status,standDown);
		return shopSellInfoList;
	}

	@Override
	public List<Map> selectShopSellInfoByuserIdStatus(String userId, int status) {
		List<Map> shopSellInfoList = shopSellInfoMapper.selectShopSellInfoByuserIdStatus(userId, status);
		return shopSellInfoList;
	}

	@Override
	public boolean update(ShopSellInfo shopSellInfo) {
		int result = shopSellInfoMapper.update(shopSellInfo);
		return result>0?true:false;
	}

	@Override
	public boolean updateShopStatus(ShopSellInfo shopSellInfo) {
		int result = shopSellInfoMapper.updateShopStatus(shopSellInfo);
		return result>0?true:false;
	}

	@Override
	public List<Map> selectShopSellInfoByIdStand(String userId,Integer sStatus) {
		List<Map> standShopSellInfoList = shopSellInfoMapper.selectShopSellInfoByIdStand(userId,sStatus);
		return standShopSellInfoList;
	}

	@Override
	public List<Map> imageInfoById(int shopId) {
		List<Map> imageInfo = shopSellInfoMapper.imageInfoById(shopId);
		return imageInfo;
	}

	@Override
	public List<Map> shopListByTime(String fromDate, String toDate, String userId, int sStatus) {
		@SuppressWarnings("rawtypes")
		List<Map> shopList = shopSellInfoMapper.shopListByTime(fromDate, toDate, userId, sStatus);
		return shopList;
	}

	@Override
	public boolean updateIdentStatus(Integer identStatus,Integer shopId) {
		int result = shopSellInfoMapper.updateIdentStatus(identStatus,shopId);
		return result>0?true:false;
	}

	@Override
	public List<Map> selectAllShopSellInfo() {
		List<Map> allShopList =  shopSellInfoMapper.selectAllShopSellInfo();
		return allShopList;
	}

	@Override
	public List<Map> shopSellInfoByIcdn(String icdn) {
		List<Map> shopSellInfo =  shopSellInfoMapper.shopSellInfoByIcdn(icdn);
		return shopSellInfo;
	}
	
}
